<template>
  <c-select
    v-bind="$attrs"
    v-on="$listeners"
    :clearable="clearable"
    :value="value"
    :options="cateList"
    :props="props"
  ></c-select>
</template>

<script>
export default {
  components: {},
  props: {
    value: {
      type: String,
      default: '',
    },
  },
  model: {
    prop: 'value',
    event: 'change',
  },
  data() {
    return {
      cateList: [],
      props: {
        value: 'id',
        label: 'categoryName',
      },
    }
  },
  computed: {
    clearable() {
      return this.$attrs.clearable !== false
    },
  },
  watch: {},
  created() {
    this.getData()
  },
  mounted() {},
  methods: {
    async getData() {
      const [res] = await this.$utils.promise(
        this.$http.get('/industrial/category/farmCategoryList')
      )
      this.cateList = (res && res.data) || []
    },
  },
}
</script>

<style lang="scss" scoped></style>
